﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace HYBYSoft.Company.Models
{

    public class CompanyAndLinkmanRelation
    {
        [Display(Name = "公司ID")]
        public int CompanyID { get; set; }

        [Display(Name = "公司名称")]
        [Required(ErrorMessage="不允许为空"),StringLength(16,ErrorMessage="超过公司名称最大字符数")]
        public string Name { get; set; }

        [Display(Name = "公司法人")]
        [Required(ErrorMessage = "不允许为空"), StringLength(8, ErrorMessage = "超过最大字符数")]
        public string Corporation { get; set; }

        [Display(Name = "地址")]
        [Required(ErrorMessage = "不允许为空"), StringLength(32, ErrorMessage = "超过最大字符数")]
        public string Address { get; set; }

        [Display(Name = "联系电话1")]
        [RegularExpression(@"((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)",ErrorMessage="输入正确的电话号码格式")]
        [Required(ErrorMessage="不允许为空")]
        public string TelFirst { get; set; }

        [Display(Name = "联系电话2")]
        [RegularExpression(@"((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)", ErrorMessage = "输入正确的电话号码格式")]
        public string TelSecond { get; set; }

        [Display(Name = "联系电话3")]
        [RegularExpression(@"((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)", ErrorMessage = "输入正确的电话号码格式")]
        public string TelThird { get; set; }

        [Display(Name = "公司规模")]
        [Required(ErrorMessage = "不允许为空"), StringLength(16, ErrorMessage = "超过最大字符数")]
        public string Scale { get; set; }

        [Display(Name = "邮编")]
        [RegularExpression(@"^\d{5,6}$", ErrorMessage = "输入正确的邮编号码格式")]
        [Required(ErrorMessage = "不允许为空")]
        public string Postcode { get; set; }
        
        [Display(Name = "传真")]
        [RegularExpression(@"^((\+?[0-9]{2,4}\-[0-9]{3,4}\-)|([0-9]{3,4}\-))?([0-9]{7,8})(\-[0-9]+)?$", ErrorMessage = "输入正确的传真格式")]//可以匹配的字符串如：+123 -999 999 ； +123-999 999 ；123 999 999 ；+123 999999等
        public string Fax { get; set; }

        [Display(Name = "公司类型")]
        [Required(ErrorMessage = "不允许为空")]
        public string Type { get; set; }

        [Display(Name = "所属行业")]
        [Required(ErrorMessage = "不允许为空")]
        public string Trade { get; set; }

        [Display(Name = "主营业务")]
        [Required(ErrorMessage = "不允许为空"), StringLength(64, ErrorMessage = "超过最大字符数")]
        public string Business { get; set; }

        [Display(Name = "资质荣誉")]
        [StringLength(300, ErrorMessage = "最多输入300个字符")]
        public string Honor { get; set; }

        [Display(Name = "公司描述")]
        [StringLength(300,ErrorMessage="最多输入300个字符")]
        public string Description { get; set; }

        [Display(Name = "E-Mail")]
        [RegularExpression(@"^[0-9a-zA-Z_\.\-]+@([0-9a-zA-Z_\-\.])+[\.]+[a-z]{2,4}$", ErrorMessage = "请输入正确的邮箱格式")]
        public string E_mail { get; set; }

        [Display(Name = "所在地")]
        public string City { get; set; }

        public IEnumerable<Linkman> Linkmen { get; set; }
    }

}
